Method and apparatus for detecting the type of interface to which a peripheral device is connected

ABSTRACT

A peripheral device is connectable to a computer having one of a first interface and a second interface. The first interface communicates with the peripheral device over a differential data connection having a first data conductor and a second data conductor. The second interface communicates with the peripheral device over a clock conductor and a single ended data connection which includes a data conductor. The peripheral device has first and second communication conductors configured for connection to the first and second data conductors in the differential data connection when the computer includes the first interface and is configured for connection to the first data conductor in the single ended data connection and the clock conductor when the computer is provided with the second interface. The peripheral device includes an interface detection component coupled to the first and second communication conductors and configured to detect which of the first and second interfaces the peripheral device is connected to. The peripheral device also includes a controller component configured to communicate between the peripheral device according to a protocol corresponding to the detected interface.

REFERENCE TO CO-PENDING APPLICATION

This is a continuation of the application Ser. No. 10/850,564, filed May20, 2004, which is a continuation of application Ser. No. 10/260,188,filed Sep. 30, 2002, now U.S. Pat. No. 6,795,949, which is acontinuation of application Ser. No. 09/410,413, filed on Oct. 1, 1999,now U.S. Pat. No. 6,442,734, which is a continuation-in-part ofapplication Ser. No. 09/112,171, filed on Jul. 8, 1998, now U.S. Pat.No. 6,460,094, and assigned to the same assignee as the presentapplication, and which are hereby incorporated by reference, and fromwhich priority is claimed.

BACKGROUND OF THE INVENTION

The present invention relates to a peripheral device connectable to acomputer. More particularly, the present invention relates to aperipheral device configured to detect the type of interface to which itis connected.

A wide variety of peripheral devices are currently configured to beconnectable to computers. Such peripheral devices commonly include userinput devices, such as keyboards, point and click devices (traditionallyreferred to as a computer mouse) and other similar types of devices.

The computer to which such devices are connected communicates with thedevices through one of a number of interfaces. Interfaces commonly usedto connect to such peripheral devices include a serial interface (suchas an RS232 interface) and a PS2 interface. Indeed, the PS2 interfacehas long been a standard for connecting keyboards and mice to computers.

However, recently, another serial interface referred to as a universalserial bus (USB) interface has been introduced. The USB interfaceaccommodates a wide variety of computer peripherals, including keyboardsand mice. However, a conventional computer is typically provided withonly one interface (such as a PS2 or USB interface) for communicationwith peripheral devices. Therefore, if the computer is provided with aPS2 interface, the keyboard or mouse must be configured to supportcommunication with the computer according to a protocol defined by thePS2 interface. Similarly, if the computer is provided with the USBinterface, the keyboard or mouse must be configured to communicateaccording to a protocol defined by the USB interface.

In order to do this, a conventional computer peripheral device containsa microprocessor which runs a software program to carry out thefunctions of that particular peripheral device. In the device such as akeyboard or mouse, the software program includes an interface betweenthe peripheral device and the host computer, through which theperipheral device communicates with the host computer. Suchcommunication often includes receiving commands from the host computerand transmitting data and status information to the host computer.

As discussed above, the PS2 and USB interfaces have different hardwareand software requirements, which must be met by the microprocessor inthe peripheral device so that the peripheral device can communicate withthe host computer. The PS2 interface uses two conductors which include aseparate clock conductor and a separate data conductor. These conductorsare driven by the computer through an open-collector or open-draincircuit, and have a pull-up resistor (typically in the range of 2 k ohmsto 10 k ohms) pulling the conductor to a rail voltage (such as VCC)inside the host computer. The open-collector or open-drain circuit(commonly a transistor) is typically implemented inside themicroprocessor. Another pull-up resistor is required inside theperipheral device as well. The peripheral device communicating over aPS2 interface is responsible for providing a clock signal on the clockconductor, regardless of the direction of data flow on the dataconductor. The host computer pulls the clock conductor to a logic lowlevel to inhibit communication from the peripheral device, and it canalso pull the data conductor low to signal to the peripheral device thatthe host computer intends to transmit data to the peripheral device.

The USB interface also uses two conductors which include differentialdata signal conductors D+ and D−. In the USB interface at the USB port(i.e., at the host computer or USB hub), the two conductors are pulledto a logic low level via 15 k ohm resistors. In the peripheral device,the D+ conductor is pulled to approximately 3.3 volts via a 1.5 k ohmresistor if the peripheral device is a high-speed USB peripheral device.The D− conductor is pulled to 3.3 volts via a 1.5 k ohm resistor if theperipheral device is a low-speed USB peripheral device. When aperipheral device is attached to the USB port, the USB host determineswhether it is a low-speed or high-speed device by determining which ofthe D+ or D− conductors is pulled to the logical high level.

Thus, it can be seen that the two interfaces have different hardwarestructures, and communicate using different software protocols.Traditionally, separate peripheral devices have been provided, one beingconfigured to communicate with a USB interface, and the other beingconfigured to communicate with a PS2 interface. This requires themanufacturer of such peripheral devices to offer two different types ofperipheral devices in order to support these two different interfaces.

SUMMARY OF THE INVENTION

The present invention defines a method and apparatus in the peripheraldevice such that the peripheral device can determine which type ofinterface it is connected to, and configure itself accordingly.

The peripheral device is connectable to a computer having one of a firstinterface and a second interface. The first interface communicates witha peripheral device over a differential data connection having a firstdata conductor and a second data conductor. The second interfacecommunicates with the peripheral device over a clock conductor and asingle-ended data connection, which includes a data conductor. Theperipheral device has first and second communication conductorsconfigured for connection to the first and second data conductors in thedifferential data connection and to the first data conductor in thesingle ended data connection and the clock conductor. The peripheraldevice includes an interface detection component configured to detectwhich of the first and second interfaces the peripheral device isconnected to. The peripheral device also includes a controller componentconfigured to communicate between the peripheral device and the computeraccording to a protocol corresponding to the detected interface.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an exemplary environment in which an inputdevice in accordance with the present invention can be used.

FIGS. 2A-2C illustrate conventional high-speed and low-speed USBperipheral devices and a PS2 peripheral device coupled to a USBinterface and a PS2 interface, respectively.

FIGS. 3A and 3B illustrate a peripheral device in accordance with thepresent invention coupled to a USB interface and a PS2 interface,respectively.

FIG. 4 is a flow diagram illustrating operation of a peripheral devicein accordance with one aspect of the present invention.

FIG. 5 is a block diagram illustrating another embodiment in accordancewith one aspect of the present invention.

FIG. 6 is a block diagram illustrating operation of a peripheral devicein accordance with another embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The present invention includes a method and apparatus, implemented in aperipheral device, by which the peripheral device detects whether it iscoupled to a PS2 interface or a USB interface. A peripheral device, inaccordance with one aspect of the present invention, senses the state ofthe interface, changes a hardware configuration of the interface throughsoftware control, and observes the effect of the configuration change onthe state of the interface. The nature of changes on the interfaceallows the peripheral device to determine which type of interface it isconnected to, and thus allows the peripheral device to configure itselfappropriately.

FIG. 1 and the related discussion are intended to provide a brief,general description of a suitable computing environment in which theinvention may be implemented. Although not required, the invention willbe described, at least in part, in the general context ofcomputer-executable instructions, such as program modules, beingexecuted by a personal computer or other computing device. Generally,program modules include routine programs, objects, components, datastructures, etc. that perform particular tasks or implement particularabstract data types. Moreover, those skilled in the art will appreciatethat the invention may be practiced with other computer systemconfigurations, including hand-held devices, multiprocessor systems,microprocessor-based or programmable consumer electronics, network PCs,minicomputers, mainframe computers, and the like. The invention is alsoapplicable in distributed computing environments where tasks areperformed by remote processing devices that are linked through acommunications network. In a distributed computing environment, programmodules may be located in both local and remote memory storage devices.

With reference to FIG. 1, an exemplary environment for the inventionincludes a general purpose computing device in the form of aconventional personal computer 20, including processing unit 21, asystem memory 22, and a system bus 23 that couples various systemcomponents including the system memory to the processing unit 21. Thesystem bus 23 may be any of several types of bus structures including amemory bus or memory controller, a peripheral bus, and a local bus usingany of a variety of bus architectures. The system memory includes readonly memory (ROM) 24 a random access memory (RAM) 25. A basicinput/output 26 (BIOS), containing the basic routine that helps totransfer information between elements within the personal computer 20,such as during start-up, is stored in ROM 24. The personal computer 20further includes a hard disk drive 27 for reading from and writing to ahard disk (not shown), a magnetic disk drive 28 for reading from orwriting to removable magnetic disk 29, and an optical disk drive 30 forreading from or writing to a removable optical disk 31 such as a CD ROMor other optical media. The hard disk drive 27, magnetic disk drive 28,and optical disk drive 30 are connected to the system bus 23 by a harddisk drive interface 32, magnetic disk drive interface 33, and anoptical drive interface 34, respectively. The drives and the associatedcomputer-readable media provide nonvolatile storage of computer readableinstructions, data structures, program modules and other data for thepersonal computer 20.

Although the exemplary environment described herein employs a hard disk,a removable magnetic disk 29 and a removable optical disk 31, it shouldbe appreciated by those skilled in the art that other types of computerreadable media which can store data that is accessible by a computer,such as magnetic cassettes, flash memory cards, digital video disks,Bernoulli cartridges, random access memory (RAM), read only memory(ROM), and the like, may also be used in the exemplary operatingenvironment.

A number of program modules may be stored on the hard disk, magneticdisk 29, optical disk 31, ROM 24 or RAM 25, including an operatingsystem 35, one or more application programs 36, other program modules37, and program data 38. A user may enter commands and information intothe personal computer 20 through input devices such as a keyboard 40 andpointing device (or mouse) 42. Other input devices (not shown) mayinclude a microphone, joystick, game pad, satellite dish, scanner, orthe like. These and other input devices are often connected to theprocessing unit 21 through one of a plurality of ports. For instance,keyboard 40 and mouse 42 are connected through a PS2 or USB interface45. In the illustrative embodiment, interface (or port) 45 is coupled tothe system bus 23. User input devices may also be connected by otherinterfaces, such as a sound card, a parallel port, or a game port. Amonitor 47 or other type of display device is also connected to thesystem bus 23 via an interface, such as a video adapter 48. In additionto the monitor 47, personal computers may typically include otherperipheral output devices such as speakers and printers (not shown).

The personal computer 20 may operate in a networked environment usinglogic connections to one or more remote computers, such as a remotecomputer 49. The remote computer 49 may be another personal computer, aserver, a router, a network PC, a peer device or other network node, andtypically includes many or all of the elements described above relativeto the personal computer 20, although only a memory storage device 50has been illustrated in FIG. 1. The logic connections depicted in FIG. 1include a local area network (LAN) 51 and a wide area network (WAN) 52.Such networking environments are commonplace in offices, enterprise-widecomputer network intranets and the Internet.

When used in a LAN networking environment, the personal computer 20 isconnected to the local area network 51 through a network interface oradapter 53. When used in a WAN networking environment, the personalcomputer 20 typically includes a modem 54 or other means forestablishing communications over the wide area network 52, such as theInternet. The modem 54, which may be internal or external, is connectedto the system bus 23 via the serial port interface 46. In a networkenvironment, program modules depicted relative to the personal computer20, or portions thereof, may be stored in the remote memory storagedevices. It will be appreciated that the network connections shown areexemplary and other means of establishing a communications link betweenthe computers may be used.

FIGS. 2A-2C illustrate conventional peripheral devices coupled toconventional interfaces. FIG. 2A illustrates a high-speed USB peripheraldevice 100 connected through USB interface 102 to CPU 21 of hostcomputer 20. It should be noted that high-speed USB peripheral device100 can be any suitable peripheral device. Peripheral device 100 isconnected to USB interface 102 and communicates therewith over twoconductors 104 and 106. Conductors 104 and 106 are connected tocorresponding conductors 108 and 110 through USB connector 112.Conductors 104 and 106 carry signals denoted D+ and D− in a high-speedUSB device. Signals D+ and D− are differential digital data signals withwhich peripheral device 100 communicates with computer 20.

In a high-speed USB arrangement, conductor 104, which carries signal D+,is pulled to a logical high level (such as VCC) by a pull-up resistor114. Resistor 114 is preferably valued such that the voltage potentialto which conductor 104 is pulled is approximately 3.3 volts. Therefore,resistor 114 can, for instance, be a 7.5 k ohm resistor connected to a 5volt VCC rail.

In USB interface 102 on computer 20, both conductors 108 and 110 (whichcorrespond to the D+ and D− signals) are pulled to a logic low level bytwo 15 k ohm resistors 116 and 118. When peripheral device 100 isinitially attached to computer 20 through USB interface 102, computer 20can determine that peripheral device 100 is a high-speed USB peripheraldevice because the conductor 104 corresponding to signal D+ is pulled toa logical high level, while conductor 106 which corresponds to signal D−is not.

FIG. 2B illustrates the connection of a low-speed USB peripheral device120 to computer 20. Some items are similar to those shown in FIG. 2A,and are similarly numbered. However, rather than having conductor 104(corresponding to signal D+) pulled to a logical high level withresistor 114, conductor 106 (which corresponds to signal D−) is pulledto a logical high level with resistor 122. Thus, computer 20 determinesthat peripheral device 120 is a low-speed USB device.

FIG. 2C illustrates another peripheral device 124 connected to computer20. Peripheral device 124 is configured to communicate with computer 20through a PS2 interface 126. PS2 peripheral device 124 communicates withcomputer 20 over a pair of conductors 104 and 106, which correspond to adata signal and a clock signal. Conductors 104 and 106 are connected totransistors 131 and 133, which are configured as open-collector oropen-drain switches controlled by the microprocessor in peripheraldevice 124. Conductors 104 and 106 are connected to conductors 108 and110 through PS2 connector 128. Conductors 104 and 106 are pulled to alogical high level at peripheral device 124 by resistors 130 and 132which are typically in a 2 k-10 k ohm range.

In PS2 interface 126, conductors 108 and 110 are also pulled to alogical high level by resistors 134 and 136, which are also typically ina 2 k-10 k ohm range. Conductors 108 and 110 are also coupled to groundby transistors 138 and 140, which are typically open-drain oropen-collector and driven by appropriate circuitry in processor 21. Itshould also be noted that transistors 138 and 140 can typically beimplemented inside processor 21, or discretely.

With the open-collector configured interface, when a logical 1 iswritten to either conductor 108 or 110, the conductor is not activelydriven high. Instead, it is pulled high, to nearly the rail voltage VCC,via the pull-up resistors 134 and 136. In this manner, either hostprocessor 21 or peripheral device 124 can drive the conductor lowwithout the concern of the conductor already being actively driven high.

Peripheral device 124 is responsible for providing the clock signal overconductors 106 and 110, to host processor 21, regardless of thedirection of data flow over conductors 104 and 108. Host processor 21can pull the conductor 110 carrying the clock signal low by controllingtransistor 140 appropriately. This inhibits communication fromperipheral device 124. Host processor 21 can also pull the dataconductor 108 low by manipulating transistor 138 in order to signalperipheral device 124 that host processor 21 intends to transmit data.

FIG. 3A illustrates host computer 20 coupled to a peripheral device 142in accordance with one aspect of the present invention. A number ofitems are similar to those shown in FIGS. 2A-2C, and are similarlynumbered. Also, in FIG. 3A, computer 20 is provided with USB interface102, rather than PS2 interface 126.

Peripheral device 142 includes communication controller 144, switchcontroller 146, and signal level detector 148. Peripheral device 142 isalso coupled to first switch 150 and second switch 152. Switches 150 and152 are coupled to a rail voltage VCC, and to pull-up resistors 154 and156 which are, in turn, coupled to conductors 158 and 160. Conductors158 and 160 are provided to connector 112 for connection to conductors108 and 110 at computer 20.

FIG. 3B shows peripheral device 142 coupled to host computer 20. In FIG.3B, host computer 20 is provided with PS2 interface 126, rather than USBinterface 102. It should be noted that, regardless of the particularinterface 102 or 126 with which host computer 20 is provided, peripheraldevice 142 is the same.

In accordance with one aspect of the present invention, pull-upresistors 154 and 156 are switched on and off under the control ofswitch controller 146, which is preferably implemented in themicroprocessor of peripheral device 142. While transistors 150 and 152are shown as discrete switching transistors, they can also beimplemented within the microprocessor of peripheral device 142, suchthat the side of resistor 154 coupled to switch 150 can be connecteddirectly to an input pin of the microprocessor in peripheral device 142,as can the side of resistor 156 coupled to switch 152. Further, whileswitches 150 and 152 are illustrated as bipolar junction transistors,other switch mechanisms can be used as well, such as field effecttransistors, relays, etc.

It should also be noted that the data signal of PS2 interface 126 andthe D+ signal of the USB interface 102 are coupled to conductor 158, andthe PS2 clock signal and the D− signal are coupled to conductor 160.Thus, peripheral device 142 can operate as a high-speed USB peripheraldevice or as a PS2 device. The relationship between the signals isreversed (i.e., the D+ and D− signals are reversed with respect to thePS2 clock and data signals) when peripheral device 142 is configured tooperate as a low-speed USB peripheral device or a PS2 device. Further,these relationships could be reversed. An adapter is preferably providedin connector 112 to accommodate different connections used for the PS2and the two types of USB interfaces.

FIG. 4 is a flow diagram, which illustrates the operation of peripheraldevice 142. Upon being connected to computer 20, peripheral device 142receives power from computer 20. Power-up of peripheral device 142 isillustrated by block 180. Switch controller 146 in peripheral device 142then turns off both switches 150 and 152. This disables pull-upresistors 154 and 156 from pulling conductors 158 and 160 to a logicalhigh voltage potential, effectively disconnecting resistors 154 and 156from the rail voltage VCC. Disabling the pull-ups is indicated by block182 in FIG. 4.

Signal level detector 148 then detects whether the signal level oneither conductor 158 or 160 is at a logical high level. Signal leveldetector 148 can be any suitable signal level detector. This isindicated by block 184.

If either or both conductors 158 or 160 are carrying a logical highsignal, peripheral device 142 concludes that it is connected to a PS2interface 126, rather than a USB interface 102. This is because, withpull-up resistors 154 and 156 disabled, the pull-down resistors 116 and118 in USB interface 102 would tend to pull conductors 108 and 110 (andhence conductors 158 and 160) to a logical low level. Therefore, ifeither of the conductors are at a logical high level, the conductors arebeing pulled high by resistors 134 and 136 in the PS2 interface 126.

However, if both conductors are low, peripheral device 142 cannot yetdetermine which type of interface it is connected to. For example, inthe USB interface 102, pull-down resistors 116 and 118 could be pullingthe conductors to a logic low level. However, it is also valid for PS2interface 126 to have switches 138 and 140 energized thus driving theconductors carrying both the data and clock signals to a logical lowlevel. Therefore, upon power-up and disabling of pull-up resistors 154and 156, if the signals on both conductors 158 and 160 are at a logicallow level, peripheral device 142 needs to take additional steps todetermine which type of interface it is connected to.

Switch controller 146 then turns on switch 150 to enable pull-upresistor 154. It should be noted that the particular pull-up resistorenabled at this point is that pull-up resistor which is connected to thePS2 data conductor and the USB D+ conductor for a high-speed USB device,or the PS2 data conductor and the USB D− conductor for a low-speed USBdevice. The flow diagram illustrated in FIG. 4 illustrates operation ofthe PS2/high-speed USB peripheral device.

In any case, once pull-up resistor 154 is enabled by switch controller146 turning on switch 150, signal level detector 148 again looks at thesignal level on conductor 158. If that signal stays at a logical lowlevel, peripheral device 142 can safely conclude that it is connected toPS2 port 126, rather than a USB port 102. This is because, with pull-upresistor 154 enabled, in order for there to be a logical low levelsignal on conductor 158, conductor 158 must be positively driven to alow level by transistor 138 in PS2 interface 126. The enabled pull-upresistor 154 would otherwise pull conductor 158 to a logical high levelif it had been connected to USB interface 102.

Enabling pull-up resistor 154 and detecting the signal level onconductor 158 is indicated by blocks 186 and 188 in FIG. 4.

If, on the other hand, after the pull-up resistor 154 is enabled, theassociated conductor is not at a logical low level, then peripheraldevice 142 is probably connected to a USB interface 102. This assumptioncan be made most of the time, and thus peripheral device 142 canoptionally stop the detection algorithm at this point and run the USBsoftware. This is indicated by dashed arrow 190 in FIG. 4.

However, there is a small chance that peripheral device 142 could beconnected to a PS2 interface 126 wherein the host processor 21coincidentally allowed the data signal to go to a logical high level atthe same instant that switch controller 146 enabled pull-up resistor154. Peripheral device 142 can thus take additional steps to furtherensure that its determination as to the type of interface is correct. Inthat instance, switch controller 146 disables pull-up resistor 154, andsignal level detector 148 then determines whether the signal level oneither of conductors 158 or 160 is at a logical high level. This isindicated by blocks 192 and 194 in FIG. 4.

If either conductor is at a logical high level, then peripheral device142 can safely assume that it is connected to a PS2 interface 126,rather than a USB interface 102. If, on the other hand, neither of theconductors is at a logical high level, peripheral device 142 can assumethat it is connected to USB interface 102, rather than a PS2 interface126. In addition, peripheral device 142 can safely conclude that it isconnected to a PS2 device if, at any time, it is determined that the PS2clock signal has assumed a logical high level.

The probability of a second, coincidental switching by the hostprocessor 21 of the data signal back to a logical low level at the sameinstant that the switch controller 146 disables the pull-up resistor 146is very low, since such a reversal, namely, data signal low to high tolow, while the clock signal remains low, is a violation of the PS2protocol.

Once the peripheral device 142 has determined which type of interface itis connected to, it branches to a portion of its software code thatsupports that type of interface and the code operates to turn onresistors appropriate to the detected interface. This is indicated byblocks 196 and 198 in FIG. 4.

It should be noted that while FIG. 4 has been described with respect totesting of the conductor carrying the PS2 data signal, the presentinvention can be carried out by testing the conductor carrying the PS2clock signal instead. The process is the same.

FIG. 5 is a block diagram of another peripheral device 200 in accordancewith another aspect of the present invention. Peripheral device 200includes USB microcontroller 202 which includes USB controller component204, connection type determination component 205 and PS2 controllercomponent 206. Peripheral device 200 also includes pull up resistor 208,resistors 210 and 212, and switch 214. Microcontroller 200 also includesa plurality of input/output (I/O) pins 216, 218, 220, 222 and 224.

Microcontroller 202 also includes USB differential data outputs D+ andD− provided on pins 226 and 228. The D+ and D− pins 226 and 228 arecoupled to conductors which represent USB D+ and USB D− signals for ahigh-speed USB device, and PS2 data and PS2 clock signals, respectively,for a PS2 device.

When peripheral device 200 is attached to host processor 21 througheither PS2 interface 126 or USB interface 102, connection typedetermination component 205 determines what type of interface peripheraldevice 200 is connected to. Microcontroller 202 is powered up andinitially provides a signal on I/O pin 224 causing switch 214 to remainopen. Component 205 first examines pin 218 to determine the level of thesignal on pin 218. If the signal level is at a logic one (or logicalhigh level), component 205 determines that peripheral device 200 isconnected to a PS2 interface 126. This is because, with switch 214 open,and pin 218 at a logical high level, the signal level must be beingpulled high by the pull up resistor in the PS2 interface.

On the other hand, if the signal level on pin 218 is still at a logicalzero (or a logical low level) the component 205 provides a logical highoutput on pin 216. This essentially enables pull up resistor 210.Component 205 then again examines the signal level on pin 218. If thesignal is at a logical low level, the signal is being actively drivenlow by the interface to the host system. Thus, the interface must be aPS2 interface. However, if the signal is pulled up to a logical highlevel, then the interface is determined to be a USB interface.

If the interface to which peripheral device 200 is connected isdetermined to be a USB interface, then USB controller 204 provides asignal on pin 224 causing switch 214 to be closed. In addition,microcontroller 202 provides pins 216, 218, 220 and 222 in a highimpedance state. USB controller component 204 then simply controlscommunication with the host system according to a USB protocol usingdifferential data D+ and D−.

If, on the other hand, the interface is determined to be a PS2interface, then switch 214 is maintained in the open position andmicrocontroller 202 provides signals on pins 216 and 220 in a logicalhigh level thus enabling pull up resistors 210 and 212 (both of whichare illustratively 2.2 k ohms). PS2 controller component 206 thencontrols communications using pins 218 and 222 as the PS2 data and PS2clock lines, respectively.

It should be noted that some USB devices have a serial interface enginewhich is permanently enabled. A condition in which both differentialdata signals D+ and D− go to a logical zero causes the part to resetitself. By providing switch 214, with pull up resistor 208, the presentinvention ensures that when switch 214 is open, the D+ signal to USBcontroller 204 is always maintained at a logical high level.

Further, other USB controllers 204 may require both the differentialdata signals D+ and D− to be disconnected when PS2 controller 206 iscontrolling communication with the PS2 interface. In that case, anadditional switch is placed in the D− conductor and is maintained in theopen position during determination of the connection type, and duringcommunication if the interface type is determined to be a PS2 interface.If, on the other hand, the interface type is determined to be a USBinterface, the switches are both closed and USB controller 204 controlscommunication according to the USB protocol.

In a recent revision to the standard USB specification, a change wasmade which requires a USB hub device, after receiving a Bus Reset andprior to configuration, to drive a logic low 0 on its down stream ports.On hubs which implement power switching, this change does not present aproblem because power is not supplied down stream of the hub deviceuntil after the hub device has been configured.

However, self powered hubs (particularly root hubs) are not required toimplement power switching. Therefore, there is a possibility that poweris present and that D+ and D− are driven to 0 on a USB port with nodevice attached. This may be the state of the port when the presentdetection algorithm is invoked (i.e., upon power-up or attachment).Therefore, it may be desirable for the algorithm not to assume, underthese circumstances, that the device is attached to a PS2 port.

FIG. 6 thus illustrates a flow diagram showing operation of thedetection algorithm in a manner which is somewhat different from thatshown in FIG. 4. Portions of FIGS. 4 and 6 are similar and are similarlynumbered. However, after the PS2 DATA/USB D+ pull-up resistor 154 isenabled at block 186, it is determined whether either line is high. Thisis indicated by block 240. If so, processing continues at block 192 asdescribed with respect to FIG. 4.

However, if, at block 240, it is determined that neither line is high,the system can simply wait until one of the conductors goes high andproceed at block 192 or 242. Alternatively, upon detecting that neitherline is high, at block 240, the PS2 DATA/USB D+ pull-up resistor 154 isdisabled. This is indicated by block 242, and processing reverts toblock 184. Thus, a forced SEO on a USB port, or a forced low PS2 Dataline is treated as an indeterminate state, and the algorithm simplywaits until that particular state or condition ends. It is believed thatthis delay will not last in excess of approximately 10 ms which will notlikely be noticed by the user.

In an illustrative embodiment, the determination of the interfaceconnection type can be done at power-up only, or it can be repeated uponsoftware exception, such as might occur from a watchdog time out or anelectrostatic discharge event, or it can be repeated at regularintervals during normal operation.

As with FIG. 4, the signals mentioned in FIG. 6 can be combineddifferently such that either the PS2 data or PS2 clock signals can beassociated with either the USB D+ or USB D− signals. This type of systemis contemplated to be within one illustrative embodiment of the presentinvention.

Thus, it can be seen that the present invention provides a method andapparatus by which a peripheral device can determine whether it isconnected to a USB interface or a PS2 interface. The manufacturer ofsuch peripheral devices need only support one product, rather than twoseparate products, yet will still accommodate connection to computerswith both types of interfaces.

Although the present invention has been described with reference topreferred embodiments, workers skilled in the art will recognize thatchanges may be made in form and detail without departing from the spiritand scope of the invention.

1. A peripheral device connectable to a computer that communicates withthe peripheral device through an interface that includes at least twointerface conductors and that is either a USB interface or a PS/2interface, the USB interface having first and second data conductors,that carry first and second data signals, as the two interfaceconductors and the PS/2 interface having a clock conductor, that carriesa clock signal, and a data conductor, that carries a data signal, as thetwo interface conductors, the peripheral device comprising: first andsecond peripheral device conductors operably connectable to theinterface conductors such that signals can be communicated between theperipheral device and the computer over the interface conductors and theperipheral device conductors; an interface detector configured to detectwhether the computer has the USB interface or the PS/2 interface bysensing signals communicated over at least one of the peripheral deviceconductors; and a controller configured to communicate with the computerbased on which interface is detected.
 2. (canceled)
 3. (canceled) 4.(canceled)
 5. (canceled)
 6. (canceled)
 7. (canceled)
 8. (canceled) 9.(canceled)
 10. (canceled)
 11. (canceled)
 12. (canceled)
 13. (canceled)14. (canceled)
 15. (canceled)
 16. A peripheral device connectable to acomputer having one of a first interface and a second interface, thefirst interface communicating with the peripheral device over adifferential data connection including a first data conductor and asecond data conductor, and the second interface communicating with theperipheral device over a single ended data connection, including a firstdata conductor, and a clock conductor, the peripheral device comprising:first and second communication conductors configured for connection tothe first and second data conductors in the differential data connectionwhen the computer includes the first interface, and configured forconnection to the first data conductor in the single ended dataconnection and the clock conductor when the computer includes the secondinterface; an interface detection component, coupled to the first andsecond communication conductors, configured to monitor the first andsecond communication conductors to detect which of the first and secondinterfaces the peripheral device is connected to and to provide aconnection output indicative of the detected interface; and a controllercomponent, coupled to the interface detection component, configured tocommunicate between the peripheral device and the computer over thefirst and second communication conductors according to a protocolcorresponding to the detected interface based on the connection output.